<?php
require "./template/header.php";
?>
	<body>
		<div id="warp">
			<div id="header">
				<div id="logo">
					<a href="./">
						<img border="0" src="./images/logo.png">
					</a>
				</div>
			</div>
			<div id="content">
				<div id="tool-content">
					<div id="tool-content-menu">
							<ul>
								<li>工具箱:</li>
								<li><a href="./help.php">挂Q帮助</a></li>
								<li><a href="./search.php">挂Q查询</a></li>
								<li><a href="./count.php">网站统计</a></li>
								<li><a id="tool-content-menu-on">找回密码</a></li>
								<li><a href="./about.php">关于我们</a></li>
								<li><a href="./" id="tool-content-gohome">去首页</a></li>
							</ul>
					</div>
					<div id="tool-content-main">
						<div id="tool-content-main-forgotpassword">
							<div id="tool-content-main-forgotpassword-tou">
								挂Q安全中心
							</div>
							<div id="tool-content-main-forgotpassword-main">
								<form action="" method="post">
									<div id="tool-content-main-forgotpassword-email">
										登录邮箱:<input type="text" name="email">
									</div>
									<div id="tool-content-main-forgotpassword-question">
										密保问题:
										<select name="question">
											<option selected="slected">注册时的密保问题?</option>
											<option value="1000">我最喜欢的老师</option>
											<option value="2000">我最喜欢的女神</option>
											<option value="3000">我最喜欢的颜色</option>
											<option value="4000">我最喜欢的游戏</option>
										</select>
									</div>
									<div id="tool-content-main-forgotpassword-answer">
										密保答案:<input type="text" name="answer">
									</div>
									<div id="tool-content-main-forgotpassword-button">
										<button type="submit">提交答案</button>
									</div>
								</form>
								<div id="forgotpassword-password">
									<?php
										if (isset($_POST['email']) or isset($_POST['question']) or isset($_POST['answer'])){
											if ($_POST['email']=="" or $_POST['question']=="" or $_POST['answer']==""){
												echo "每项都必须填不能留空";
											}else{
												$mysql_forgotpassword = mysql_query("SELECT * FROM xige_user WHERE email='".$_POST['email']."'");
												$info_forgotpassword=mysql_fetch_array($mysql_forgotpassword);
												if ($_POST['question']==$info_forgotpassword['question']){
													if ($_POST['answer']==$info_forgotpassword['answer']){
														echo '您的密码是:<span id="forgotpassword-color">'.$info_forgotpassword['pass'].'</span>';
													}else{
														echo "密保《答案》错误请重新找回";
													}
												}else{
													echo "密保《问题》错误请重新找回";
												}
											}
										}
									?>
									<!--  -->
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div id="footer">
<?php 
require "./template/footer.php";
?>